﻿using System;
using OpenComposite.EII.Repository;
using System.Windows.Forms;
namespace OpenComposite.EII
{
	public interface IRepositoryExplorerView
	{
		event EventHandler<ItemSelectedEventArgs> AddDiagram;
		event EventHandler<ItemSelectedEventArgs> CreateProcessForMethod;
		event EventHandler<ItemSelectedEventArgs> DeleteItem;
		event EventHandler<ItemSelectedEventArgs> ItemSelected;
		event EventHandler<ItemSelectedEventArgs> OpenDiagram;

		TreeType Type { get; set; }

		IRepositoryExplorerTree CurrentRepositoryTree { get; }
		void UpdateCurrentRepository();
		void UpdateRepository(int id);
		void UpdateTreeNode(System.Windows.Forms.TreeNode tn);
		void UpdateTrees();

		void SelectRepositoryItem(IRepositoryItem item);
		void SelectRepositoryItem(IRepositoryItem item, bool activate);
	}

	#region Enum: TreeType
	public enum TreeType
	{
		DomainEditor = 0,
		ProcessDesigner
	}
	#endregion

	#region Class: ItemSelectedEventArgs
	public class ItemSelectedEventArgs : EventArgs
	{
		public ItemSelectedEventArgs(ItemType type, TreeNode node, int idRepository)
		{
			_type = type;
			_node = node;
			_idRepository = idRepository;
		}

		private readonly TreeNode _node;
		public TreeNode Node
		{
			get { return _node; }
		}
		private readonly ItemType _type;
		public ItemType Type
		{
			get { return _type; }
		}
		private readonly int _idRepository;
		public int RepositoryId
		{
			get { return _idRepository; }
		}

	}
	#endregion
}
